#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

int main(){
    int n, q;
    cin >> n >> q;
    int op, ii, jj, k;
    map <long long, int> b;
    for(int i = 1; i <= q; i++){
        scanf("%d", &op);
        if(op == 1){
            scanf("%d %d %d", &ii, &jj, &k);
            b[ii * 100000 + jj] = k;
        }
        if(op == 2){
            scanf("%d %d", &ii, &jj);
            printf("%d\n", b[ii*100000 + jj]);
        }
    }
    return 0;
}